package com.iwhalecloud.citybrain.flow.platform.manager.domain.model.monitor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.enums.NoticeTypeEnum;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.FlowRuTimeoutSettingVo;
import org.springframework.beans.BeanUtils;

/**
 * @author lilh
 * @date 2019-08-15 18:35
 */
public class TaskNoticeVo implements Serializable {
    private static final long serialVersionUID = 10564403981775850L;

    /**
     * 任务id
     */
    private String taskId;

    /**
     * 通知设置id
     */
    private Long ruNoticeSettingId;

    /**
     * 通知类型
     */
    private String type;

    /**
     * 标题
     */
    private String title;

    /**
     * 内容
     */
    private String content;

    private List<NoticeItemVo> noticeItems = new ArrayList<>();

    public TaskNoticeVo() {
    }

    public TaskNoticeVo(FlowRuTimeoutSettingVo setting) {
        BeanUtils.copyProperties(setting, this);
        this.ruNoticeSettingId = setting.getId();
        this.type = NoticeTypeEnum.getDescrByCode(this.type);
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public Long getRuNoticeSettingId() {
        return ruNoticeSettingId;
    }

    public void setRuNoticeSettingId(Long ruNoticeSettingId) {
        this.ruNoticeSettingId = ruNoticeSettingId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public List<NoticeItemVo> getNoticeItems() {
        return noticeItems;
    }

    public void setNoticeItems(List<NoticeItemVo> noticeItems) {
        this.noticeItems = noticeItems;
    }

    public static class NoticeItemVo {

        /**
         * 具体通知项id
         */
        private Long ruNoticeChannelId;

        /**
         * 通知人
         */
        private String receiver;

        /**
         * 渠道
         */
        private String channel;

        /**
         * 通讯录地址
         */
        private String address;

        /**
         * 状态
         */
        private String noticeStatus;

        /**
         * 发送时间
         */
        @JsonProperty("sendTime")
        private Date updateTime;

        public Long getRuNoticeChannelId() {
            return ruNoticeChannelId;
        }

        public void setRuNoticeChannelId(Long ruNoticeChannelId) {
            this.ruNoticeChannelId = ruNoticeChannelId;
        }

        public String getReceiver() {
            return receiver;
        }

        public void setReceiver(String receiver) {
            this.receiver = receiver;
        }

        public String getChannel() {
            return channel;
        }

        public void setChannel(String channel) {
            this.channel = channel;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getNoticeStatus() {
            return noticeStatus;
        }

        public void setNoticeStatus(String noticeStatus) {
            this.noticeStatus = noticeStatus;
        }

        public Date getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(Date updateTime) {
            this.updateTime = updateTime;
        }
    }
}
